#!/bin/bash

# 从CSV文件中读取"Pass or Fail"列
result=$(tail -n +2 test_result.csv | awk -F',' '{
    # 去掉可能存在的双引号和空格
    gsub(/"| /, "", $4);
    print $4;
}')

has_fail=false

# 遍历每个结果
for status in $result; do
    if [ "$status" = "Fail" ]; then
        has_fail=true
        break # 找到Fail后立即退出循环
    fi
done

# 根据has_fail的状态决定输出结果
if [ "$has_fail" = true ]; then
    echo "Fail"
else
    echo "Pass"
fi
